<template>
  <div v-if="show">
    <div style="text-align: left;" v-if="show">
      <a-row>
        <a-col :span="6" class="item">
          <span>订单号: </span>{{ data.allocateAndTransferNo }}
        </a-col>
        <a-col :span="6" class="item">
          <span>调拨日期: </span>{{ data.allocateAndTransferTime }}
        </a-col>
        <a-col :span="6" class="item">
          <span>调出仓库: </span>{{ data.outDepository }}
        </a-col>
        <a-col :span="6" class="item">
          <span>调入仓库: </span>{{ data.inDepository }}
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="6" class="item">
          <span>创建人: </span>{{ data.createBy }}
        </a-col>
        <a-col :span="6" class="item">
          <span>创建日期: </span>{{ data.createTime }}
        </a-col>
        <a-col :span="6" class="item">
          <span>备注: </span>{{ data.remark }}
        </a-col>
      </a-row>
      <a-table :columns="columns" :data-source="data.materials" bordered />
    </div>
  </div>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
  name: "TransfersOrder",
  data() {
    return {
      data: '',
      show: false,
      url: {
        getTransfersOrderById: '/ghSupplychainAllocateAndTransfer/getById',
      },
      columns: [
        {
          title: '名称',
          dataIndex: 'materialName',
          scopedSlots: { customRender: 'materialName' },
        },{
          title: '型号',
          dataIndex: 'modelNumber',
        },{
          title: '规格',
          dataIndex: 'specifications',
        },{
          title: '品牌',
          dataIndex: 'brand',
        },{
          title: '市场价格',
          dataIndex: 'marketPrice',
        },{
          title: '预算价',
          dataIndex: 'estimatedCost',
        },{
          title: '数量',
          dataIndex: 'transferNum',
        },{
          title: '单价',
          dataIndex: 'costPrice',
        },{
          title: '小计金额',
          customRender:function (record) {
            return (record.transferNum * record.costPrice)
          }
        },{
          title: '备注',
          dataIndex: 'remark',
        }
      ]
    }
  },
  methods: {
    initData(params) {
      getAction(this.url.getTransfersOrderById, params).then(res => {
        if (res.success) {
          this.data = res.result;
        }
      });
    }
  }
}
</script>
<style>
  .item {
    padding: 15px
  }
</style>